<template>
  <el-dialog
    title="流转数据"
    :visible.sync="dialogVisible"
    width="1000px">
<!--    <ul>-->
<!--      <li v-for="item in datajson">{{item}}</li>-->
<!--    </ul>-->
    <el-table
      :data="dataList"
      border
      ref="singleTable"
      highlight-current-row
      :header-cell-style="{background:'#17b3a3',color:'#FFFFFF'}"
      v-loading="dataListLoading"
      style="width: 100%;">
<!--      <el-table-column-->
<!--        type="selection"-->
<!--        header-align="center"-->
<!--        align="center"-->
<!--        width="50">-->
<!--      </el-table-column>-->
      <el-table-column
        prop="productno"
        header-align="center"
        align="center"
        label="物料编号">
      </el-table-column>
      <el-table-column
        prop="serialno"
        header-align="center"
        align="center"
        label="序列号">
      </el-table-column>
      <el-table-column
        prop="type"
        header-align="center"
        align="center"
        label="物料类型">
      </el-table-column>
      <el-table-column
        prop="location"
        header-align="center"
        align="center"
        label="当前位置">
      </el-table-column>
      <el-table-column
        prop="container"
        header-align="center"
        align="center"
        label="当前托盘">
      </el-table-column>
      <el-table-column
        prop="tolocation"
        header-align="center"
        align="center"
        label="目标位置">
      </el-table-column>
      <el-table-column
        prop="tocontainer"
        header-align="center"
        align="center"
        label="目标托盘">
      </el-table-column>
      <el-table-column
        prop="lastupdateon"
        header-align="center"
        align="center"
        label="更新时间">
      </el-table-column>
    </el-table>
  </el-dialog>
</template>

<script>
export default {
  name: 'materialflow',
  data(){
    return {
      dataForm: {
        key: ''
      },
      datajson: [],
      dataList: [],
      pageIndex: 1,
      pageSize: 10,
      totalPage: 0,
      dataListLoading: false,
      dataListSelections: [],
      addOrUpdateVisible: false,
      Visiable: false,
      dialogVisible:false
    }
  },
  methods:{
    // 3.定义一个init函数，通过设置detailVisible值为true来让弹窗弹出，这个函数会在父组件的方法中被调用
    init(productno){
      this.dialogVisible = true;
      console.log('zi' + productno)
      this.dataForm.key = productno;
      this.$http({
        url: this.$http.adornUrl('/materialcopy/materialtestcopy1/listMaterialFlowInfo'),
        method: 'get',
        params: this.$http.adornParams({
          'productNo': this.dataForm.key
        })
      }).then(({data}) => {
        if (data) {
          console.log(data)
          this.dataList = data
        } else {
          this.dataList = []
        }
        this.dataListLoading = false
      })
      // this.$http({
      //   url: this.$http.adornUrl('/poschangerecord/poschangerecordtable/uuTest'),
      //   method: 'get',
      //   async: false,
      //   params: this.$http.adornParams({
      //     'matid': this.dataForm.key
      //   })
      // }).then(({data}) => {
      //   this.datajson = data
      //   console.log(data)
      //   this.dataListLoading = false
      // })
    }
  }
}
</script>

<<style lang="scss">
.tr-color-0 {
  background: #f0f0f0;
}
.tr-color-1 {
  background: #fff;
}
.el-table .success-row {
  background: #DFEAF5;
}
</style>
